// https://leetcode.cn/problems/two-sum/

package main

import (
	"fmt"
)

// you can also use imports, for example:
// import "fmt"
// import "os"

// you can write to stdout for debugging purposes, e.g.
// fmt.Println("this is a debug message")

func twoSum(nums []int, target int) []int {
	m := make(map[int]int, len(nums))
	for i1, v := range nums {
		if i2, ok := m[target-v]; ok {
			return []int{i1, i2}
		}
		m[v] = i1
	}
	return []int{}
}

func main() {
	r := twoSum([]int{3, 2, 4}, 6)
	fmt.Print(r, "\n")
}
